<template>
	<view class="flex shop-container" @click="onShopDetail">
		<view class="shop-image-container">
			<view class="shop-image">
				<image :src="detail.mer_avatar" mode="widthFix" class="image"></image>
			</view>
			<!-- <view class="score-container">
				<view class="image-score">
					4.9 <text>分</text>
				</view>
				<view class="score-text">
					好吃个锤子好吃个锤子好吃个锤子
				</view>
			</view> -->
		</view>
		<view class="info">
			<view class="title">
				{{detail.mer_name}}
			</view>
			<view class="detail flex">
				<view class="left flex">
					<view class="score">
						{{averageScore}}分
					</view>
					<view class="sales">
						月售{{detail.sales}}
					</view>
				</view>
				<view class="right flex">
					<view class="sales">
						32分钟
					</view>
					<view class="sales">
						6.5km
					</view>
				</view>
			</view>
			<view class="goods-list">
				<scroll-view 
					class="shop-scroll"
					scroll-x="true" 
					style="white-space: nowrap;" 
					scroll-with-animation show-scrollbar="true"
				>
					<div class="scroll-container" >
						<view class="goods-item" v-for="item in detail.recommend" :key="item.cate_id">
							<view class="goods-image">
								<image :src="item.image" mode="widthFix" class="image"></image>
							</view>
							<view class="goods-detail">
								<view class="goods-title">
									{{item.store_name}}
								</view>
								<view class="goods-money">
									<text class="money-sign">￥</text>{{item.price}}
								</view>
							</view>
						</view>
						<view class="loadmore">
							<view class="icon">
								
							</view>
							<view class="loadmore-text">
								查看更多
							</view>
						</view>
					</div>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				
			}
		},
		computed:{
			averageScore(){
				const score = (this.detail.postage_score * 1 + this.detail.product_score * 1 + this.detail.service_score * 1) / 3 
				return score.toFixed(1)
			}
		},
		props:{
			detail:{
				type:Object,
				required:true
			}
		},
		methods:{
			onGods(id){
				console.log("XXX")
			},
			onShopDetail(){
				const detail = JSON.stringify(this.detail)
				uni.navigateTo({
					url:`/pages/localLife/view/shopDetail?id=${this.detail.mer_id}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "../style/index.scss";
</style>